// .txt

beginzonescript;

variables;

short crime_tolerance = 5;
short last_abil;
short i;

body;

beginstate INIT_STATE;
	if (gf(11,5) > 1)
		set_terrain(28,3,0);

	set_name(8,"Agent Micheline");
	set_name(12,"Dorgum");
	set_name(13,"Juergen");
	set_name(14,"Sergeant Schick");
	set_name(17,"Denna");
	set_name(18,"Lel");
	if (gf(11,9) > 0)
		erase_char(18);
	set_name(19,"Clerissa");
	set_name(20,"Abderra");

	set_aggression(29,9);
	set_aggression(30,9);
	set_aggression(31,9);
	set_aggression(32,9);
	
	set_name(38,"Refugee");
	set_name(39,"Refugee");
	set_name(40,"Refugee");

	set_level(42,25);
	set_name(42,"Mera Guard");
	set_level(45,25);
	set_name(45,"Mera Guard");

	set_level(46,25);
	set_name(46,"Caravan Guard");
	set_level(47,25);
	set_name(47,"Caravan Guard");
	
	set_name(48,"Refugee");
	set_name(49,"Refugee");
	set_name(50,"Refugee");
	set_name(51,"Modell");
	if ((gf(10,5) < 2) || (gf(10,3) > 0))
		erase_char(51);

	set_name(52,"Customs Officer");

	set_name(53,"Merchant");
	set_name(54,"Merchant");
	set_name(55,"Merchant");
		
//	add_range_to_group(first,last,whichg);

	if (gf(100,11) > 0) {
		print_str_color("Word of your infamy has gotten here before you. You are forever marked",3);
		print_str_color("  as a foe of the Shapers.",3);
		sf(11,1,1);
		}
	if (get_sdf(11,1) > 0) {
		make_zone_hostile();
		set_courage(53,0);
		set_courage(54,0);
		set_courage(55,0);
		
		if (gf(11,5) > 0) {
			set_courage(46,0);
			set_courage(47,0);
			set_courage(48,0);
			set_courage(49,0);
			set_courage(50,0);
			set_courage(51,0);
			set_courage(17,0);
			set_courage(19,0);
			set_courage(53,0);
			set_courage(54,0);
			set_courage(55,0);
			}
		}
		else {
			print_str_color("This is a friendly city. You are able to rest.",2);
			revive_party();
			}	
	last_abil = get_current_tick();
	
	set_crime_tolerance(crime_tolerance);
	break;

beginstate EXIT_STATE;

break;

beginstate START_STATE;
	if ((gf(11,1) > 0) && (gf(100,2) == 2)) {
		sf(100,2,3);
		print_str_color("Now that Mera is angry with you, you will no longer be",3);
		print_str_color("  able to serve Astoria.",3);
		}
		
	// clear zone?
	//if ((zone_clear(ME) == FALSE) && (get_flag(,) > 0)) {
		//print_str_color("",2);
		//clear_zone(ME);	
		//}
		
	if ((get_crime_level() >= crime_tolerance) && (get_sdf(11,1) == 0)) {
		make_zone_hostile();
		set_flag(11,1,1);
		}

	if (gf(11,1) == 0) {
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(8,"Have a supplication?");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(8,"The hall is closed.");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(8,"Watch for rebels.");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(8,"Beware the Trakovites.");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(12,"Don't touch the essence.");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(12,"It takes great care.");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(12,"Do you need a blade?");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(13,"We must talk.");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(13,"Speak quietly.");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(13,"Need new pants?");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(14,"Terrible.");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(14,"Keep more alert.");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(14,"Need better defenses.");
		if (gf(11,14) < 2) {
			if (get_ran(1,0,100) < 10)
				give_char_text_bubble(17,"I have information.");
			if (get_ran(1,0,100) < 10)
				give_char_text_bubble(17,"Have a seat.");
			if (get_ran(1,0,100) < 10)
				give_char_text_bubble(17,"Let's talk.");
			}
			else if (get_ran(1,0,100) < 30)
				give_char_text_bubble(17,"I'll wait for you.");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(18,"So you are here.");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(18,"Sigh.");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(18,"Care to see my wares?");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(19,"Complainers wait.");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(19,"Settle down!");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(19,"I'm coming!");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(20,"I have come far.");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(20,"Exotic goods!");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(20,"Reasonable prices!");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(20,"Buying and selling!");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(46 + get_ran(1,0,1),"Something smells. You!");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(46 + get_ran(1,0,1),"Barkeep!");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(46 + get_ran(1,0,1),"Hey, shorty!");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(46 + get_ran(1,0,1),"You're dumb! Ha ha!");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(48 + get_ran(1,0,3),"Not much money left.");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(48 + get_ran(1,0,3),"Need a job. Any job.");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(48 + get_ran(1,0,3),"Hard times.");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(48 + get_ran(1,0,3),"Better here than most.");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(48 + get_ran(1,0,3),"Can we afford it?");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(56,"Moo.");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(57,"Moo.");
		}
	
	//if (((is_combat()) && (tick_difference(last_abil,get_current_tick()) > 0)) || ((is_group()) && (tick_difference(last_abil,get_current_tick()) > 5))) {
	//	last_abil = get_current_tick();
	//	}
break;

beginstate 10;
	set_terrain_string_range("The sign says - HALL OF APPEALS. Form queue around building to left.",3);
break;

beginstate 11;
	set_terrain_string_range("The sign says - The Mera Inn.",3);
break;

beginstate 12;
	set_terrain_string_range("The sign says - .",3);
break;

beginstate 13;
	set_terrain_string_range("The sign says - .",3);
break;

beginstate 14;
	set_terrain_string_range("The sign says - .",3);
break;

beginstate 15;
	set_terrain_string_range("The sign says - .",3);
break;

beginstate 16;
	set_terrain_string_range("The sign says - .",3);
break;

//	print_str("");
//	set_terrain_string_range(".",3);
//	set_terrain_string_range("The sign says - .",3);
